/*
 * ser_proto.h
 *
 *  Created on: 09.06.2010
 *      Author: Phil
 */

#ifndef SER_PROTO_H_
#define SER_PROTO_H_

typedef struct _SerProtoDecodeState {
	unsigned char *dest;
	unsigned int dest_size;
	unsigned int dest_pos;
	unsigned char state;
	unsigned char byte;
	unsigned char checksum;

} SerProtoDecodeState;

extern int SerProto_Encode(unsigned char *dest, unsigned int dest_size,
		const unsigned char *packet, unsigned int packet_size);

extern void SerProto_DecodeInit(SerProtoDecodeState *state, unsigned char *dest,
		unsigned int dest_size);

extern int SerProto_DecodeLength(SerProtoDecodeState *state);

extern unsigned int SerProto_Decode(SerProtoDecodeState *state,
		const unsigned char *data, unsigned int data_pos, unsigned int data_size);

#endif /* SER_PROTO_H_ */
